import os

import tornado.ioloop
import tornado.web


# base_dir = os.path.dirname(__file__)


class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        data = {
            'title': 't1',
            'msg': 'very good',
            'num': 100,
        }
        self.render('temp.html', **data)


def make_app():
    return tornado.web.Application(
        [
            (r'/', IndexHandler),
        ],
        debug=True,
        # use temp static
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        static_path=os.path.join(os.path.dirname(__file__), "static"),
        # xsrf_cookies=True,
        # cookie_secret="secret",
        # login_url="/login",
        # cookie_secret="secret",
        # transforms=[],
        # autoreload=True
    )


if __name__ == '__main__':
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()
